﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ThanNhanTao.Server;
using DevExpress.Xpf.Ribbon;
using System.Windows.Controls;
using System.Windows;
using DevExpress.Xpf.Bars;
using System.Windows.Media;
using DevExpress.Xpf.Editors.Settings;
using ThanNhanTao.Server.Entities;

namespace ThanNhanTao.CommonControl
{
    public class ThanNhanTaoGlobal
    {
        private static DateTime ngayLamViec;
        private static int idBenhNhanXoa;
        private static int numBerSoLanChayThan;
        private static List<DateTime> listNgayXoa;
        private static List<BenhNhan> danhSachBenhNhan;
        private static List<HoSoNhanSuEntities> listHoSoNhanSu;
        public static int SLBenhNhanDangDieuTri;
        public static int SLBenhNhanDaXuatVien;
        public static MainWindow MainWindowCommon {get;set;}

        public static MainWindow MainWinDowTemp { get; set; }

        public static int NumBerSoLanChayThan
        {
            get { return ThanNhanTaoGlobal.numBerSoLanChayThan; }
            set { ThanNhanTaoGlobal.numBerSoLanChayThan = value; }
        }

        public static int IdBenhNhanXoa
        {
            get { return ThanNhanTaoGlobal.idBenhNhanXoa; }
            set { ThanNhanTaoGlobal.idBenhNhanXoa = value; }
        }

        public static DateTime NgayLamViec
        {
            get { return ThanNhanTaoGlobal.ngayLamViec; }
            set { ThanNhanTaoGlobal.ngayLamViec = value; }
        }

        public static List<DateTime> ListNgayXoa
        {
            get
            {
                if (listNgayXoa == null)
                    return new List<DateTime>();
                return listNgayXoa;
            }
            set
            {
                listNgayXoa = value;
            }
        }

        public static List<BenhNhan> DanhSachBenhNhan
        {
            get
            {
                if (danhSachBenhNhan == null)
                    return new List<BenhNhan>();
                return danhSachBenhNhan;
            }
            set
            {
                danhSachBenhNhan = value;
            }
        }

        public static List<HoSoNhanSuEntities> ListHoSoNhanSu
        {
            get
            {
                if (listHoSoNhanSu == null)
                    return new List<HoSoNhanSuEntities>();
                return listHoSoNhanSu;
            }
            set
            {
                listHoSoNhanSu = value;
            }
        }

        public static bool SetThongTinChungFormMain()
        {
            if (MainWinDowTemp == null)
                return false;
            try
            {
                BarEditItem thongTin = MainWinDowTemp.staticItemThongTinChung as BarEditItem;
                thongTin.EditValue = String.Format("Số BN đang điều trị: {0} \nSố BN đã ra viện: {1}", SLBenhNhanDangDieuTri, SLBenhNhanDaXuatVien);
                return true;
            }
            catch (Exception)
            {
                return false;
            }
            
        }
    }
}
